package com.example.demo.pojo.dto;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

@Getter
@Setter
@ToString
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class ForgetPasswordDTO {
    @NotBlank(message = "手机号码不能为空")
    @Pattern(regexp = "^1[0-9]{10}$", message = "手机号码格式错误")
    private String phone;

    @NotBlank(message = "密码不能为空")
    @Length(min = 6, max = 20, message = "密码长度限定为6-20个字符")
    private String newPassword;

    @NotBlank(message = "密码不能为空")
    @Length(min = 6, max = 20, message = "密码长度限定为6-20个字符")
    private String rePassword;

    @NotBlank(message = "验证码不能为空")
    @Pattern(regexp = "^[0-9]{4}$", message = "验证码为4位纯数字")
    private String code;

    public ForgetPasswordDTO() {
    }

    public ForgetPasswordDTO(String phone, String newPassword, String rePassword, String code) {
        this.phone = phone;
        this.newPassword = newPassword;
        this.rePassword = rePassword;
        this.code = code;
    }
}
